/**
 * FileName: MainActivity2
 * Author: Administrator
 * Date: 2020/12/24 0024 14:55
 * Description:
 */
package com.linkage.linkedlife.viewmodel;

import android.os.Bundle;

import com.linkage.linkedlife.R;
import com.linkage.linkedlife.base.BaseActivity;

import cn.leancloud.AVObject;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * @ClassName: MainActivity2
 * @Description: java类作用描述
 * @Author: Clark
 * @Date: 2020/12/24 0024 14:55
 */
class MainActivity2 extends BaseActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_ding);

// 构建对象
        AVObject todo = new AVObject("Dingding");

// 为属性赋值
        todo.put("title", "马拉松报名");
        todo.put("priority", 2);

// 将对象保存到云端
        todo.saveInBackground().subscribe(new Observer<AVObject>() {
            public void onSubscribe(Disposable disposable) {
            }

            public void onNext(AVObject todo) {
                // 成功保存之后，执行其他逻辑
                System.out.println("保存成功。objectId：" + todo.getObjectId());
            }

            public void onError(Throwable throwable) {
                // 异常处理
            }

            public void onComplete() {
            }
        });


    }
}